<%@page isELIgnored="false" import="java.net.*" %>
<%@taglib prefix="tiles" uri="struts-tiles" %>
<%@taglib prefix="html" uri="struts-html" %>
<%@taglib prefix="c" uri="jstl" %>
<%@taglib prefix="mcfn"     uri="mcfn" %>
<%@taglib prefix="fn" uri="jstl-fn" %>
					<div id="bodyContent">
						<h1>Alerts</h1>
						<div class="errors"><html:errors/>${UserLogin.messageError}</div>
<c:choose>
<c:when test="${fn:length(Alertas) eq 0}">At present you do not have pending notifications</c:when>
<c:otherwise>
						<html:form action="/AlertsMarcarLeida" method="post" styleId="form2">
						<html:hidden property="cveAlertaUsuario" styleId="cveAlertaUsuario"/>
                                                <html:hidden property="tipoNotificacion" styleId="tipoNotificacion"/>
						<table class="tabDatos">
							<thead>
								<tr>
									<th>Status</th>
									<th>Start date</th>
									<th>Alert</th>
									<th>End date</th>
									<th></th>
								</tr>
							</thead>

<c:forEach items="${Alertas}" var="al" >
							<tr>
								<td align="center" width="10%"><c:choose><c:when test="${al.leida eq 1}">Unread</c:when><c:when test="${al.leida eq 2}">Read</c:when></c:choose></td>
								<td align="center" width="10%">${mcfn:formatDate(al.fechaAlta,'dd/MM/yyyy') }</td>
                                                                <c:if test="${al.tblNotificacion.tipoNotificacion eq 1}">
                                                                    <td width="460">
                                                                        <a href="AssetsBDMTitular.do" title="List of Assets">${al.texto}</a>
                                                                    </td>                                                                    
                                                                </c:if>
                                                                <c:if test="${al.tblNotificacion.tipoNotificacion eq 2}">
                                                                    <td width="460">
                                                                        <a href="AssetsBDMTitular.do" title="List of Assets">${al.texto}</a>
                                                                    </td>                                                                    
                                                                </c:if>
                                                                <c:if test="${al.tblNotificacion.tipoNotificacion eq 3}">
                                                                    <td width="460">
                                                                            <a href="#" onclick="document.getElementById( 'cveAlertaUsuario' ).value=${al.cveAlertaUsuario};
                                                                                document.getElementById( 'tipoNotificacion' ).value=${al.tblNotificacion.tipoNotificacion};
                                                                                document.form2.submit(); return false" title="Go">${al.texto}</a>
                                                                    </td>                                                                    
                                                                </c:if>
                                                                <c:if test="${al.tblNotificacion.tipoNotificacion eq 4}">
                                                                    <td width="460">
                                                                            <a href="#" onclick="document.getElementById( 'cveAlertaUsuario' ).value=${al.cveAlertaUsuario};
                                                                                document.getElementById( 'tipoNotificacion' ).value=${al.tblNotificacion.tipoNotificacion};
                                                                                document.form2.submit(); return false" title="Go" title="Go">${al.texto}</a>
                                                                    </td>                                                                    
                                                                </c:if>
                                                                <c:if test="${al.tblNotificacion.tipoNotificacion eq 5}">
                                                                    <td width="460">
                                                                        <a href="ListarPaquetesAsignados.do" title="Assigned package list">${al.texto}</a>
                                                                    </td>                                                                    
                                                                </c:if>
                                                                <c:if test="${al.tblNotificacion.tipoNotificacion eq 6}">
                                                                    <td width="460">
                                                                        <a href="ListarCampanasBanco.do" title="List of campaigns">${al.texto}</a>
                                                                    </td>                                                                    
                                                                </c:if>
                                                                <c:if test="${al.tblNotificacion.tipoNotificacion eq 7}">
                                                                    <td width="460">
                                                                        <a href="ListarCampanas.do" title="List of campaigns">${al.texto}</a>
                                                                    </td>                                                                    
                                                                </c:if>
                                                                <c:if test="${al.tblNotificacion.tipoNotificacion eq 8}">
                                                                    <td width="460">
                                                                        <a href="ListarCampanas.do" title="List of campaigns">${al.texto}</a>
                                                                    </td>                                                                    
                                                                </c:if>
                                                                 <c:if test="${al.tblNotificacion.tipoNotificacion eq 10}">
                                                                    <td width="460">
                                                                            <a href="Assets.do" title="List of campaigns">${al.texto}</a>
                                                                    </td>                                                                    
                                                                </c:if>
                                                                <c:if test="${al.tblNotificacion.tipoNotificacion ne 1 and al.tblNotificacion.tipoNotificacion ne 2 and al.tblNotificacion.tipoNotificacion ne 3 and al.tblNotificacion.tipoNotificacion ne 4 and al.tblNotificacion.tipoNotificacion ne 5
                                                                and al.tblNotificacion.tipoNotificacion ne 6 and al.tblNotificacion.tipoNotificacion ne 7 and al.tblNotificacion.tipoNotificacion ne 8 and al.tblNotificacion.tipoNotificacion ne 10 }">
                                                                    
                                                                        <td width="460">${al.texto}</td>
                                                                    
                                                                </c:if>								
								<td align="center" width="10%">${mcfn:formatDate(al.fechaLimite,'dd/MM/yyyy') }</td>
								<td align="center" width="15%">Label as read <html:image src="images/btnIrAlerta.gif" onclick="document.getElementById( 'cveAlertaUsuario' ).value=${al.cveAlertaUsuario}; return true ;"/></td>
							</tr>
</c:forEach>

						</table>
						</html:form>

<c:if test="${fn:length(AlertasLeidas) gt 0}">
<br/>
<div onmouseout="this.style.cursor='default';" onmouseover="this.style.cursor='pointer';" onclick="if( document.getElementById( 'AlertasLeidas' ).style.display == 'none' ) document.getElementById( 'AlertasLeidas' ).style.display = 'block' ; else document.getElementById( 'AlertasLeidas' ).style.display = 'none' ; " >
<h1>Alertas Le&iacute;das</h1>
</div>
<div id="AlertasLeidas" style="display: none;" >
						<table class="tabDatos">
							<thead>
								<tr>
									<th>Status</th>
									<th>Start date</th>
									<th>Alert</th>
									<th>End date</th>
									<th></th>
								</tr>
							</thead>

<c:forEach items="${AlertasLeidas}" var="al" >
							<tr>
								<td align="center" width="10%"><c:choose><c:when test="${al.leida eq 1}">Unread</c:when><c:when test="${al.leida eq 2}">Read</c:when></c:choose></td>
								<td align="center" width="10%">${mcfn:formatDate(al.fechaAlta,'dd/MM/yyyy') }</td>
								<td width="460">${al.texto}</td>
								<td align="center" width="10%">${mcfn:formatDate(al.fechaLimite,'dd/MM/yyyy') }</td>
								<td width="15%">&nbsp;</td>
							</tr>
</c:forEach>

						</table>
</div>
</c:if>

</c:otherwise>
</c:choose>
					</div>
					<div id="footContent"></div>
